import { createElement } from 'react';
import { classPrefix, linkProp } from '../../variables';
import useInsertClass from '../../hooks/useInsertClass';
import './index.scss';

export interface ParagraphProp extends linkProp{
  content?: string;
}

function Paragraph(props: ParagraphProp) {
  const {
    uiConfig = {},
    style = {},
    children,
    className = '',
    url = '',
    content = '',
  } = props;
  const insertClass = useInsertClass(uiConfig); 
  const compClass = [insertClass, `${classPrefix}-paragraph`, className].filter(t => t).join(' ');
  return (
    url ? 
    <a className={compClass} style={style} href={url}>{content || children} 这里是内容</a> :
    <p className={compClass} style={style}>{content || children} 这里是内容</p>
  ); 
};

Paragraph.displayName = 'Paragraph';
export default Paragraph;
